package svc

import (
	"github.com/zeromicro/go-zero/zrpc"
	"go-zero-all-demos/apps/api/internal/config"
	"go-zero-all-demos/apps/order/rpc/orderservice"
	"go-zero-all-demos/apps/user/rpc/userservice"
)

type ServiceContext struct {
	Config   config.Config
	UserRPC  userservice.UserService
	OrderRPC orderservice.OrderService
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:   c,
		UserRPC:  userservice.NewUserService(zrpc.MustNewClient(c.UserRPC)),
		OrderRPC: orderservice.NewOrderService(zrpc.MustNewClient(c.OrderRPC)),
	}
}
